{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## **演示0501：函数极限值**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **案例1：利用导函数求极值**\n",
    "求函数$f(x)$的极值的步骤：\n",
    "\n",
    "1. 计算其导函数$f'(x)$，然后令$f'(x)=0$，得出此时的解$x_0$\n",
    "2. 计算导函数$f'(x)$在$x=x_0$处的导数(也就是$f(x)$的二阶导数）$f'' (x_0)$\n",
    " * 如果$f''(x_0) \\gt 0$，则$x_0$为极小值点\n",
    " * 如果$f''(x_0) \\lt 0$，则$x_0$为极大值点\n",
    " * 如果$f''(x_0) = 0$，则$x_0$为非极值点，而是拐点"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    ">**示例1：利用导数计算$f(x)=x^2$的极值：**  \n",
    "$ f'(x)=2x $，令$f'(x)=0$，得：$x_0=0 $  \n",
    "$ f''(x_0)=2 $，因此$x_0=0$是极小值点  \n",
    "极小值为$f(x_0 )=f(0)=0$\n",
    "\n",
    ">**示例2：利用导数计算$f(x)=x^3$的极值：**  \n",
    "$ f'(x)=3x^2$，令$f'(x)=0$，得：$x_0=0 $  \n",
    "$ f''(x_0)=6x_0=0 $$，因此这个点不是极值点而是拐点    \n",
    "可通过其图像看到这一点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl4VdW9//H3yjySgIwhzLNMQhikWgVnelsn6i3VetWqaLUObe0V9NfJK72tta21trdarSMVJ6w4VBAlTgWVWaYwD2FKIAlkHs75/v5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MbDRq1payzl3EXA3cLGZVXhdTxT7DBjknOvnnEsApgPzPa4p6jXicqruAAAAzUlEQVSc7HwC2GBmv/O6nkA557ocvQLPOZcMnEcIcyvSrtJ5BRhC/RUhO4GbzWyPt1UFxjm3BUgEDjW8tLQdX3F0GfBHoAtQAqwyswu9rerkOee+BjwExAJ/M7PZHpcUEOfc88Bk6mdlPAD8zMye8LSoADnnzgQ+BD6n/t87wD1m9pZ3VbWcc24U8DT1v1sxwItmdl/I2oukwBcRkeOLqCEdERE5PgW+iEiUUOCLiEQJBb6ISJRQ4IuIRAkFvohIlFDgi4hECQW+iEiU+P+9JpHONrP8hQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1be6880cf60>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "''' y=x**3函数曲线图像及拐点 '''\n",
    "\n",
    "%matplotlib inline\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "def f(x):\n",
    "    return x**3\n",
    "\n",
    "x = np.linspace(-3, 3, 100)\n",
    "y = f(x)\n",
    "plt.grid()\n",
    "plt.scatter(0, 0, color='r')\n",
    "plt.plot(x, y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **案例2：使用数值方法计算$f(x)=x^2$极值**\n",
    "选择一个初始点，然后计算该点的导数，再通过导数和步长推进到下一个点，直到两个点之间的差值很小为止  \n",
    "* 该函数图像如下：  \n",
    "![](../images/050101.png)\n",
    "* 按照下列步骤执行：  \n",
    " 1. 选定一个初始值，例如$x_0=2$\n",
    " 2. 计算在该点的导数，$f'(x_0)=4$\n",
    " 3. 按照下列公式调整$x$的新值：$x_1= x_0 - \\alpha f'(x_0)$\n",
    "   * $\\alpha$称为步进系数(学习速率)，用来控制步长大小。例如设置为0.1, 0.001等\n",
    "   * $f'(x_0)$主要用来控制步长的方向。在本例中是通过正负号来控制\n",
    "   * 注意，要与导数的方向相反（所以用减号），否则将会离极值点越来越远\n",
    " 4. 计算$f(x_1)$，并且与$f(x_0)$对比，根据某个规则来判断是否已经收敛，例如：二者的差值小于某个临界误差，例如0.000001。如果尚未收敛，则继续进行上述循环\n",
    " 5. 如果在指定循环次数（例如1000次）之后仍然没有收敛，则可以认为该函数没有极值\n",
    "* 说明\n",
    " * 上图中，从点(2,4)出发，将逐步逼近(0,0)。\n",
    " * 如果初始值取为负数，则导数也为负，根据$x_1= x_0-\\alpha f'(x_0)$，$x_1 $将大于$x_0$，也就是向原点方向移动，这也是正确的。\n",
    " * 因此，通过$x_1= x_0-\\alpha f'(x_0)$来不断逼近，是一种合适的方法\n",
    "* 注意：如果函数本身有多个极值点，那么逼近法找到的是其中的一个，未必是最低的极值点：  \n",
    "![](../images/050102.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> **步骤1：定义目标函数和一阶导数**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# 定义目标函数\n",
    "def f1(x): \n",
    "    return x * x\n",
    "\n",
    "# 定义目标函数对应的一阶导函数\n",
    "def f1_dir(x):\n",
    "    return 2 * x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> **步骤2：定义使用数值方法逼近求极小值的函数并调用之**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'是否收敛': True, '极小点': 1.2259964326927117e-05, '极小值': 1.5030672529752548e-10, '循环次数': 60}\n"
     ]
    }
   ],
   "source": [
    "# 存放数值方法依次逼近的各个极值点的坐标\n",
    "temp_x = []\n",
    "temp_y = []\n",
    "\n",
    "# 数值逼近求极小值，需要传入目标函数、目标函数的一阶导数以及初始值\n",
    "def minimize(fx, fx_dir, init_x, alpha = 0.1, difference = 1e-10, max_iter = 1000):\n",
    "    current_x = init_x\n",
    "    current_y = fx(current_x)\n",
    "    for i in np.arange(max_iter):\n",
    "        new_x = current_x - alpha * fx_dir(current_x)\n",
    "        new_y = fx(new_x)\n",
    "        temp_x.append(new_x)\n",
    "        temp_y.append(new_y)\n",
    "        if np.abs(new_y - current_y) <= difference:    # 已收敛\n",
    "            return {\"是否收敛\":True, \"极小点\": new_x, \"极小值\": new_y, '循环次数': i+1}\n",
    "        current_x = new_x\n",
    "        current_y = new_y\n",
    "    return {\"是否收敛\":False, \"极小点\": np.NaN, \"极小值\": np.NaN, '循环次数': max_iter}\n",
    "\n",
    "# 计算y=x*x的极值\n",
    "result = minimize(f1, f1_dir, 8.0)\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> **步骤3：绘制收敛过程图**  \n",
    "绘制每个循环后求得的函数最小值，可以观察到最小值是如何逐渐稳定的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAEICAYAAAB/Dx7IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAEwZJREFUeJzt3W2MXGd5h/HrznohQwAtIYbGG4xBQoYUlxhWIVEAkfBikwYUpUiFlkJbJH9BKFWRaVzUCqTSQC1BKGqpTHgrpKRtYlyUAibKSylVE1jjgB0cl0AT8DrgTWHF2wo2y90PMxuczYz3jD2zc56Z6yetdufkzM79OOP/PL7Pc86JzESSVI7TBl2AJKk7BrckFcbglqTCGNySVBiDW5IKY3BLUmEMbkkqjMEttUTEhoh456DrkFZicGvkRcQFEfEOYE3r8Usi4s8HXJbUkcGtIkTE9oi4cdm2D0bENRWff2ZEHImIV7cePz4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eA/W+YvmXahuAS4BbqJ597Yix9Kq9z7grGXbinyvAU8E/pfWwo9+jacWM27a35C4u9tH1NNTM/MBgNb3pwy4nq5FxAZgM3AnBY+n1Vq4CzgG3Ax8G5jLzIdau5T0nrsGeDvwq9bjJ1PuWKB5y9AvRsS+1k3Hodz32jOBWeBjrVbWtRFxBj0eT12Cu9INibW6IuLxwI3An2Tmjwddz6nIzMXMPI/mbPV84DntdlvdqroXEZcBxzJz3/Gb2+xa+7Ec56LMfD7NVulbIuIlgy7oFKwBng98KDM3Az+jD22eugT3sN6Q+AcRcTZA6/uxAddTWUSM0wzt6zJzd2tzseNZkplzwO00e/cTrXuqQjnvuYuA10TEfcD1NNsl11DmWADIzKOt78eAz9D8YC31vXYEOJKZd7Ye30AzyHs6nroE91eBZ7WOjD8GeB3w2QHX1AufBd7U+vlNNHvFtRcRAXwEOJSZ7zvuP5U6nrURMdH6uQG8nOYBo9uA17Z2K2I8mbkjM8/JzA00/57cmpm/T4FjAYiIMyLiCUs/A68EDlLoey0zvw98LyKWbvH+MuCb9Ho8g27mH9e8v5Tm3eS/Dbxj0PWcRP2fBh4AFmh+6r6ZZu/xFuBbre9nDrrOimN5Ec1/an8DuKv1dWnB4/ktYH9rPAeBv2xtfybwFeBe4F+Bxw661i7H9VLgppLH0qr7662vu5f+7pf6XmvVfh4w3Xq/7QGe1OvxeMq7JBWmLq0SSVJFBrckFcbglqTCGNySVBiDW5IKY3BLUmEMbkkqzP8D7WgAeMVmWPIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1be72792400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 绘制数值方法求得的各个极值点\n",
    "pt_x = np.arange(len(temp_x))\n",
    "pt_y = temp_x\n",
    "plt.figure()\n",
    "plt.title('y=x*x')\n",
    "plt.plot(pt_x, pt_y, 'o')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
